tgm.Games = {}

function tgm:LoadGames()
	print ("Loading games . . .")
	local gamefolders = file.FindDir ("../lua/"..tgm.path.."/games/*")
	for _,folder in pairs (gamefolders) do
		print (folder)
		GAME = {}
		GAME.codename = folder
		GAME.fullpath = tgm.path.."/games/"..folder
		include (GAME.fullpath.."/init.lua")
		tgm.Games[folder] = GAME
		GAME = nil
	end
end

function tgm:ChangeGame (name)
	print ("Attempting load "..name)
	if not tgm.Games[name] then return end
	print ("Loading . . .")
	tgm.CurrentGame = table.Merge (table.Copy (tgm.Games.base), tgm.Games[name])
	tgm.CurrentGame.parent = tgm
	tgm.CurrentGame:Initialize()
end

//added by Nevec
//just a convenience function for getting a games tables
//may be useful
function tgm:GetGame(Name)

	local Game = tgm.Games[Name];

	if Game then

		return Game;

	end

end